<template>
  <div>
    <a-modal :centered="true" v-model:open="state.showDialog" :closable="false" :title="title" @ok="handleOk">
      <p>{{ subtitle }}</p>
    </a-modal>
  </div>
</template>

<script lang='ts' setup>
import { reactive } from 'vue';
const props = defineProps({
  title: { type: String, default: '提示' },
  subtitle: { type: String, default: '确定删除吗？' },
});

const emit = defineEmits(['confirm']);

const state = reactive({
  showDialog: false,
  row: undefined
});

// 打开弹窗
const openDialog = (row: any) => {
  state.showDialog = true
  state.row = row
};

const handleOk = () => {
  emit('confirm', state.row);
  state.showDialog = false
};

defineExpose({
  openDialog,
});
</script>
<style scoped lang='scss'></style>